package com.ygqh.baby.po;

import com.ygqh.baby.ao.DataStatus;
import com.ygqh.baby.ao.JobStatus;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

public class YgUserBargain {
    private Long id;

    private Long userId;

    private Long productId;

    private Long skuId;

    private BigDecimal productPrice;

    private Long bargainId;

    private BigDecimal targetPrice;

    private Long cutCount;

    private Long lastCutCount;

    private BigDecimal cutPrice;

    private Date finishTime;

    private JobStatus bargainStatus;

    private String generationMode;

    private Long userAddressId;

    private String platformNo;

    private DataStatus status;

    private Date createTime;

    private Date updateTime;

    private String remark;

    // ==================
    private String imagePath;

    private String productName;

    private String userName;

    private Long orderId;

    private Date orderCreateTime;

    private List<YgUserBargainDetail> cutList;

    private Boolean cutOnlyNew;

    public YgUserBargain() {
        super();
    }

    public YgUserBargain(Long userId, Long productId, BigDecimal productPrice, Long bargainId, BigDecimal targetPrice, Long cutCount,
                         BigDecimal cutPrice, Date finishTime, JobStatus bargainStatus, Date createTime, Long skuId) {
        super();
        this.userId = userId;
        this.productId = productId;
        this.productPrice = productPrice;
        this.bargainId = bargainId;
        this.cutPrice = cutPrice;
        this.finishTime = finishTime;
        this.bargainStatus = bargainStatus;
        this.createTime = createTime;
        this.targetPrice = targetPrice;
        this.lastCutCount = cutCount;
        this.cutCount = cutCount;
        this.skuId = skuId;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Long getSkuId() {
        return skuId;
    }

    public void setSkuId(Long skuId) {
        this.skuId = skuId;
    }

    public Long getUserAddressId() {
        return userAddressId;
    }

    public void setUserAddressId(Long userAddressId) {
        this.userAddressId = userAddressId;
    }

    public String getPlatformNo() {
        return platformNo;
    }

    public void setPlatformNo(String platformNo) {
        this.platformNo = platformNo;
    }

    public Long getCutCount() {
        return cutCount;
    }

    public void setCutCount(Long cutCount) {
        this.cutCount = cutCount;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public List<YgUserBargainDetail> getCutList() {
        return cutList;
    }

    public void setCutList(List<YgUserBargainDetail> cutList) {
        this.cutList = cutList;
    }

    public Date getOrderCreateTime() {
        return orderCreateTime;
    }

    public void setOrderCreateTime(Date orderCreateTime) {
        this.orderCreateTime = orderCreateTime;
    }

    public Long getOrderId() {
        return orderId;
    }

    public void setOrderId(Long orderId) {
        this.orderId = orderId;
    }

    public String getImagePath() {
        return imagePath;
    }

    public void setImagePath(String imagePath) {
        this.imagePath = imagePath;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public Date getCurrentDate() {
        return new Date();
    }

    public Long getLastCutCount() {
        return lastCutCount;
    }

    public void setLastCutCount(Long lastCutCount) {
        this.lastCutCount = lastCutCount;
    }

    public String getBargainStatusStr() {
        if (bargainStatus.equals(JobStatus.Complete)) {
            return "已完成";
        }
        return bargainStatus.getTitle();

    }

    public BigDecimal getTargetPrice() {
        return targetPrice;
    }

    public void setTargetPrice(BigDecimal targetPrice) {
        this.targetPrice = targetPrice;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getProductId() {
        return productId;
    }

    public void setProductId(Long productId) {
        this.productId = productId;
    }

    public BigDecimal getProductPrice() {
        return productPrice;
    }

    public void setProductPrice(BigDecimal productPrice) {
        this.productPrice = productPrice;
    }

    public Long getBargainId() {
        return bargainId;
    }

    public void setBargainId(Long bargainId) {
        this.bargainId = bargainId;
    }

    public BigDecimal getCutPrice() {
        return cutPrice;
    }

    public void setCutPrice(BigDecimal cutPrice) {
        this.cutPrice = cutPrice;
    }

    public Date getFinishTime() {
        return finishTime;
    }

    public void setFinishTime(Date finishTime) {
        this.finishTime = finishTime;
    }

    public JobStatus getBargainStatus() {
        if (this.bargainStatus.equals(JobStatus.Running) && System.currentTimeMillis() > finishTime.getTime()) {
            this.bargainStatus = JobStatus.Finish;
        }

        return bargainStatus;
    }

    public void setBargainStatus(JobStatus bargainStatus) {
        this.bargainStatus = bargainStatus;
    }

    public DataStatus getStatus() {
        return status;
    }

    public void setStatus(DataStatus status) {
        this.status = status;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Boolean getCutOnlyNew() {
        return cutOnlyNew;
    }

    public void setCutOnlyNew(Boolean cutOnlyNew) {
        this.cutOnlyNew = cutOnlyNew;
    }

    public String getGenerationMode() {
        return generationMode;
    }

    public void setGenerationMode(String generationMode) {
        this.generationMode = generationMode;
    }
}